package org.nfIt.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.nfIt.entity.product.Brand;
import org.nfIt.mapper.BrandMapper;
import org.nfIt.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClossName:BrandServiceImpl
 * Pakage:org.nfIt.service.impl
 * Description
 *
 * @Author L
 * @Create 2024/8/9 11:46
 * @Version 2023.1.3
 */
@Service
public class BrandServiceImpl implements BrandService {

    @Autowired
    private BrandMapper brandMapper ;

    /**
     * 查询全部品牌列表
     * @param page 当前页
     * @param limit 每页记录数
     */
    @Override
    public PageInfo<Brand> findByPage(Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<Brand> brandList = brandMapper.findByPage() ;
        return new PageInfo(brandList);
    }

    /**
     * 添加品牌
     */
    @Override
    public void save(Brand brand) {
        brandMapper.save(brand);
    }

    /**
     * 查询所有品牌
     */
    @Override
    public List<Brand> findAll() {

        return brandMapper.findAll();
    }
}
